home *** CD-ROM | disk | FTP | other *** search
- Path: erinews.ericsson.se!usenet
- From: ebcjeg@ebc.ericsson.se (Jan Granqvist)
- Newsgroups: comp.lang.c++
- Subject: Runtime error when stressing application
- Date: Tue, 16 Jan 1996 14:44:01 GMT
- Organization: Ericsson
- Message-ID: <4dgdhv$1ko@erinews.ericsson.se>
- NNTP-Posting-Host: ebcp5163.ebc.ericsson.se
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hello everybody.
-
- I've received this strange fault which occurs when stressing this
- application I'm working on, which runs under windows.
-
- To make things short.
- I call lstrlen ( pointer ), where pointer is composed by combining a
- pointer and an offset.
-
- dwDestAddressSize = lstrlen( (LPCSTR)(lp_ForwardingInfo + dwOffset ))
- + 1;
-
- When stressing this application CodeGuard complains about an invalid
- string pointer.
- So, I changed from lstrlen to strlen, which resulted in a GPF, which
- in turn I could catch in the debugger.
-
- The call stack indicated a fault in strlen. I took a look at the
- stack, and saw that the argument pushed on the stack was wrong, the
- offset to the pointer was totally wrong, the segment was however
- correct.
-
- d SS:BP
-
- 0x43A7 correct segment value
- 0x0B50 wrong offset value, should have been 0x0928
- 0x47C7 return address
- 0x4235 return address
-
- So, I took a look on the variables which creates the argument to
- strlen, and these showed the proper values.
-
- lp_ForwardList 0x43A7:0x0910
- dwOffset 0x18
-
- I then created a dummy variable
-
- lpDummy = (LPCSTR)(lp_ForwardingInfo + dwOffset );
- lpDummy = lpDummy;
-
- to see if it always came up with this result. And, it did. But still
- the variables for creating the dummy variable were right. So, I
- thought to myself, weird shit.
- I was thinking about a corrupt stack, but the return address and
- segment values were right.
- I then created a dummy function with three arguments
-
- void myfunc ( DWORD, LPSTR, DWORD );
-
- that only calls strlen, which I called
-
- myfunc ( dwResult, (LPSTR)lp_ForwardingInfo, dwOffset );
-
- to see which values pushed on the stack were wrong.
- But after I did this small change, it works, I couldn't get a GPF.
- Now, somebody tell me, what's going on.
-
- It was compiled using VC++ 1.51, large model, no optimization.
-
- I'm waiting eagerly for reply.
-
-
-